package main

import (
	"gitee.com/gcom/stockdock/comm"
	"gitee.com/gcom/stockdock/core"
	"gitee.com/gcom/stockdock/core/conf"
	_ "gitee.com/gcom/stockdock/core/job"
	"gopkg.in/yaml.v2"
	"io/ioutil"
)

func main() {
	data, err := ioutil.ReadFile("./config.yml")
	if err != nil {
		comm.Log.Fatalf("读取配置文件失败: %v", err)
	}
	err = yaml.Unmarshal(data, &conf.Settings)
	if err != nil {
		comm.Log.Fatalf("解析配置文件失败: %v", err)
	}
	conf.InitDB()

	port := conf.Settings.Server.Port
	comm.Log.Infof("start web core start, port: %d", port)
	err = core.StartServer(port)
	if err != nil {
		comm.Log.Errorf("web core start failed, port: %d", port)
	}
}
